package org.deltaset.secured.user;

import java.io.Serializable;
import javax.annotation.ManagedBean;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.web.context.WebApplicationContext;

/**
 * if the UserContext state is saved in a persistence storage this class would not be needed
 * Currently it keeps the UserContext object in HttpSession
 * @author dmakariev
 */
@ManagedBean
@Scope(value = WebApplicationContext.SCOPE_SESSION,
proxyMode = ScopedProxyMode.TARGET_CLASS)
public class UserContextStorage implements Serializable {

    private UserContext userContext;

    /**
     * @return the userContext
     */
    public UserContext getUserContext() {
        return userContext;
    }

    /**
     * @param userContext the userContext to set
     */
    public void setUserContext(UserContext userContext) {
        this.userContext = userContext;
    }
}
